//
//  ViewController.m
//  UI-05 Homework UIScrollView
//
//  Created by 冀永金 on 16/7/20.
//  Copyright © 2016年 冀永金. All rights reserved.
//

#import "ViewController.h"
#import "Album.h"
#define WIDTH self.view.frame.size.width
@interface ViewController ()

@end

@implementation ViewController
/**
 *  1完善ScrollView相册, 实现轮播及缩放恢复。
 2封装轮播图
 添加UIPageControl, 绑定事件, 有点击切换效果
 不用添加定时器
 */
- (void)viewDidLoad {
    [super viewDidLoad];
    [self createAlbum];
    // Do any additional setup after loading the view, typically from a nib.
}

- (NSArray *)handleImages {
    NSMutableArray *marrOfImages = [NSMutableArray array];
    [marrOfImages addObject:[UIImage imageNamed:@"123_11"]];
    for (int i = 1; i < 12; i ++) {
        NSString *name = [NSString stringWithFormat:@"123_%d",i];
        UIImage *image = [UIImage imageNamed:name];
        
        [marrOfImages addObject:image];
    }
    [marrOfImages addObject:[UIImage imageNamed:@"123_1"]];
    return marrOfImages;
}

- (void)createAlbum {
    NSArray *images = [self handleImages];
    Album *ab = [[Album alloc]initWithFrame:CGRectMake(0, 200, WIDTH, 400) images:images];
    [self.view addSubview:ab];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
